<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<s:include value="/WEB-INF/content/common/header.jsp" />

<h4>Sme List</h4>
<p></p>
<p></p>


<s:form action="deleteSme" namespace="/customer" id="listForm">

	<table class="table table-striped table-bordered" id="list">
		<tr>
			<!-- <th></th> -->
			<th>NAME</th>
			<th>Address</th>
			<th>Telephone</th>
			<th>Email</th>
			<th>Fax</th>
			<th>Type</th>
			<th>Category</th>
			<th>Action</th>

		</tr>


		<s:iterator value="list">

			<s:url var="urlSmeName" action="viewSmeDetails">
				<s:param name="id" value="%{id}" />
			</s:url>

			<tr>

				<%-- <td><s:checkbox theme="simple" fieldValue="%{id}" id="%{id}"
						name="selected" cssClass="checkedBox" /></td> --%>
				<td><sj:a href="%{urlSmeName}" targets="targetDiv">
						<s:property value="name" />
					</sj:a></td>
				<td><s:property value="address" /></td>
				<td><s:property value="telephone" /></td>
				<td><s:property value="email" /></td>
				<td><s:property value="fax" /></td>
				<td><s:property value="type" /></td>
				<td><s:property value="smeCategoryId" /></td>
				<td>
					<s:url action="viewEditSme" var="urlEditSmeDetails" namespace="/customer">
							<s:param name="id" value="%{id}" />
					</s:url>
					 
					<s:url var="urlAddEmployee" action="viewAddEmployeePage" namespace="/employee">
							<s:param name="id" value="%{id}" />
					</s:url> 
				
					<s:url action="viewSmeDetails" var="urlSmeDetails" namespace="/customer">
							<s:param name="id" value="%{id}" />
					</s:url> 
					
					<s:url action="deleteSme" var="urlDeleteSme" namespace="/customer">
							<s:param name="id" value="%{id}" />
					</s:url> 
					
					<sj:a href="%{urlEditSmeDetails}" cssClass="btn btn-success btn-xs " role="button"
						targets="targetDiv">Edit</sj:a> 
								
					<sj:a href="%{urlAddEmployee}" cssClass="btn btn-primary btn-xs" role="button"
						targets="targetDiv">Add Users</sj:a>
						
					<sj:a href="%{urlSmeDetails}" cssClass="btn btn-info btn-xs " role="button"
						targets="targetDiv">Details</sj:a>
						
					<sj:a href="%{urlDeleteSme}" cssClass="btn btn-danger btn-xs " role="button" id="deleteButton"
						targets="targetDiv">Delete</sj:a>
						
				</td>
						
						

						

			</tr>
		</s:iterator>



	</table>

</s:form>

<script type="text/javascript">
	$(document).ready(function() {

			
		$('#deleteButton').click(function() {
			var a = confirm("Are you sure to delete SME?");
			if (a== true) {
				event.preventDefault();
				$('#listForm').submit();
				
			} else {
				event.preventDefault();
			}
		});

	});
</script>


<s:include value="/WEB-INF/content/common/footer.jsp" />